﻿@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>企业注册界面-海南省旅游和文化广电体育厅住宿业管理系统</title>
    <link href="~/CSS/bootstrap-3.3.7/css/bootstrap.min.css" rel="stylesheet" />
    <link href="~/CSS/style.css" rel="stylesheet" />
    <link href="~/CSS/xiaoliu.css" rel="stylesheet" />
    <script src="~/JS/jquery-3.1.1.min.js"></script>
    <script src="~/JS/vue.min.js"></script>
    <script src="~/JS/laydate/laydate.js"></script>
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=1.3"></script>
    <script src="~/CSS/bootstrap-3.3.7/js/bootstrap.min.js"></script>
    <script src="~/JS/xiaoliu.js"></script>
    <style>
        body {
            width: 100%;
            margin: 0;
            padding: 0;
            border: 0;
            background-color: #FFFFFF;
            background-image: url(../../image/zc_bg.jpg);
            background-position: center 0;
        }
    </style>
</head>
<body>
    <div id="app" class="registerbox">
        <div class="title_name">企业注册</div>
        <div class="register">
            <div class="tab_name mar55">
                旅馆/民宿名称<br />
                <input v-model="modeljd.jd_name" type="text" required="required" placeholder="请输入旅馆/民宿名称" class="gao">
            </div>
            <div class="tab_name mar55">
                法人单位名称<br />
                <input v-model="modeljd.faren_danwei" type="text" required="required" placeholder="请输入法人单位单位名称" class="gao">
            </div>
            <div class="tab_name">
                法人代表<br />
                <input v-model="modeljd.faren_name" type="text" required="required" placeholder="请输入法人代表名字" class="gao">
            </div>
        </div>
        <div class="register">
            <div class="tab_name mar55">
                统一社会信用代码<br />
                <input v-model="modeljd.tongyi_xinyong_daima" type="text" required="required" placeholder="请输入社会信用代码" class="gao">
            </div>
            <div class="tab_name mar55">
                注册地址<br />
                <input v-model="modeljd.zhuce_dizhi" type="text" required="required" placeholder="" class="gao">
            </div>
            <div class="tab_name">
                注册地址邮编<br />
                <input v-model="modeljd.zhuce_dizhi_youbian" type="text" required="required" placeholder="" class="gao">
            </div>
        </div>

        <div class="register">
            <div class="tab_four marfour">
                经营地址<br />
                <input v-model="modeljd.jingying_dizhi" type="text" required="required" placeholder="" class="gao">
            </div>
            <div class="tab_four marfour">
                经营地址邮编<br />
                <input v-model="modeljd.jingying_dizhi_youbian" type="text" required="required" placeholder="" class="gao">
            </div>
            <div class="tab_four marfour">
                经度<br />
                <input v-model="modeljd.jingdu" type="text" required="required" placeholder="" class="gao" onclick="$('#myModalMap').modal('toggle')">
            </div>
            <div class="tab_four">
                维度<br />
                <input v-model="modeljd.weidu" type="text" required="required" placeholder="" class="gao" onclick="$('#myModalMap').modal('toggle')">
            </div>
        </div>

        <div class="register">
            <div class="tab_four marfour">
                行政区划<br />
                <input v-model="modeljd.xingzheng_quhua" type="text" required="required" placeholder="" class="gao" onclick="$('#myModalArea').modal('toggle')">
            </div>
            <div class="tab_four marfour">
                是否持有特行许可证<br />
                <select v-model="modeljd.has_tehang_xukezheng" class="sel_width">
                    <option value="true">是</option>
                    <option value="false">否</option>
                </select>
            </div>
            <div class="tab_four marfour">
                是否安装治安信息管理系统<br />
                <select v-model="modeljd.has_zhian_xitong" class="sel_width">
                    <option value="true">已安装</option>
                    <option value="false">未安装</option>
                </select>
            </div>
            <div class="tab_four">
                特行证编号<br />
                <input v-model="modeljd.tehangzheng_bianhao" type="text" required="required" placeholder="" class="gao">
            </div>
        </div>
        <div class="register">
            <div class="tab_four marfour">
                旅馆业备案标志序列号<br />
                <input v-model="modeljd.beian_xuliehao" type="text" required="required" placeholder="" class="gao">
            </div>
            <div class="tab_four marfour">
                经营状态<br />
                <select v-model="modeljd.jingying_zhuangtai" class="sel_width">
                    <option value="正常">正常</option>
                    <option value="试营业">试营业</option>
                </select>
            </div>
            <div class="tab_four marfour">
                企业登记注册类型<br />
                <select v-model="modeljd.zhuce_leixing" class="sel_width">
                    <option value="内资企业">内资企业</option>
                    <option value="外资企业">外资企业</option>
                    <option value="港澳台投资企业">港澳台投资企业</option>
                    <option value="中外合资企业">中外合资企业</option>
                </select>
            </div>
            <div class="tab_four">
                依据建设类型划分<br />
                <select v-model="modeljd.jianzhu_leixing_huafen" class="sel_width">
                    <option value="酒店">酒店</option>
                    <option value="家庭旅馆">家庭旅馆</option>
                    <option value="乡村民宿">乡村民宿</option>
                </select>
            </div>
        </div>
        <div class="register">
            <div class="tab_four marfour">
                依据客人类型划分<br />
                <select v-model="modeljd.keren_leixing_huafen" class="sel_width">
                    <option value="商务型">商务型</option>
                    <option value="会议型">会议型</option>
                    <option value="度假型">度假型</option>
                    <option value="长住型">长住型</option>
                </select>
            </div>
            <div class="tab_four marfour">
                依据区位类型划分<br />
                <select v-model="modeljd.quwei_leixing_huafen" class="sel_width">
                    <option value="城市酒店">城市酒店</option>
                    <option value="乡村酒店">乡村酒店</option>
                    <option value="景区酒店">景区酒店</option>
                    <option value="公路酒店">公路酒店</option>
                    <option value="机场酒店">机场酒店</option>
                </select>
            </div>
            <div class="tab_four marfour">
                依据价格类型划分<br />
                <select v-model="modeljd.jiage_leixing_huafen" class="sel_width">
                    <option value="超豪华酒店">超豪华酒店</option>
                    <option value="豪华型酒店">豪华型酒店</option>
                    <option value="高档酒店">高档酒店</option>
                    <option value="中档酒店">中档酒店</option>
                    <option value="经济型酒店">经济型酒店</option>
                    <option value="青年旅舍">青年旅舍</option>
                </select>
            </div>
            <div class="tab_four">
                依据经营方式的类型划分<br />
                <select v-model="modeljd.jingying_leixing_huafen" class="sel_width">
                    <option value="单体经营酒店">单体经营酒店</option>
                    <option value="联号经营型酒店">联号经营型酒店</option>
                    <option value="联合经营酒店">联合经营酒店</option>
                    <option value="民宿类酒店">民宿类酒店</option>
                </select>
            </div>
        </div>
        <div class="register">
            <div class="tab_four marfour">
                依据客房数量的类型划分<br />
                <select v-model="modeljd.fangshu_leixing_huafen" class="sel_width">
                    <option value="超大型酒店">超大型酒店</option>
                    <option value="大型酒店">大型酒店</option>
                    <option value="中大型酒店">中大型酒店</option>
                    <option value="中型酒店">中型酒店</option>
                    <option value="中小型酒店">中小型酒店</option>
                </select>
            </div>
            <div class="tab_four marfour">
                依据品牌类型划分<br />
                <select v-model="modeljd.pinpai_leixing_huafen" class="sel_width">
                    <option value="国外品牌">国外品牌</option>
                    <option value="国内品牌">国内品牌</option>
                </select>
            </div>
            <div class="tab_four marfour">
                依据参照星级类型划分<br />
                <select v-model="modeljd.xingji_leixing_huafen" class="sel_width">
                    <option value="五星">五星</option>
                    <option value="四星">四星</option>
                    <option value="三星">三星</option>
                    <option value="二星">二星</option>
                    <option value="一星">一星</option>
                </select>
            </div>
            <div class="tab_four">
                民宿评级等级<br />
                <select v-model="modeljd.minsu_pingji_dengji" class="sel_width">
                    <option value="金宿">金宿</option>
                    <option value="银宿">银宿</option>
                </select>
            </div>
        </div>

        <div class="register">
            <div class="tab_four marfour">
                每平方米装修造价<br />
                <select v-model="modeljd.zhuangxiu_zaojia" class="sel_width">
                    <option value="5000元及以上">5000元及以上</option>
                    <option value="3000-5000元">3000-5000元</option>
                    <option value="1500-3000元">1500-3000元</option>
                    <option value="1500元以下">1500元以下</option>
                </select>
            </div>
            <div class="tab_four marfour">
                是否为星级酒店<br />
                <select v-model="modeljd.is_xingji" class="sel_width">
                    <option value="true">是</option>
                    <option value="false">否</option>
                </select>
            </div>
            <div class="tab_four marfour">
                评星时间<br />
                <input id="inp_pingxing_riqi" type="text" required="required" placeholder="" class="gao">
            </div>
            <div class="tab_four">
                星级酒店建设标准<br />
                <select v-model="modeljd.xingji_jianshe_biaozhun" class="sel_width">
                    <option value="五星级">五星级</option>
                    <option value="四星级">四星级</option>
                    <option value="三星级">三星级</option>
                    <option value="二星级">二星级</option>
                    <option value="一星级">一星级</option>
                    <option value="无">无</option>
                </select>
            </div>
        </div>

        <div class="register">
            <div class="tab_four marfour">
                开业时间<br />
                <input id="inp_kaiye_riqi" type="text" required="required" placeholder="" class="gao">
            </div>
            <div class="tab_four marfour">
                是否为品牌酒店<br />
                <select v-model="modeljd.is_pinpai" class="sel_width">
                    <option value="true">是</option>
                    <option value="false">否</option>
                </select>
            </div>
            <div class="tab_four marfour">
                酒店所属品牌<br />
                <input v-model="modeljd.suoshu_pinpai" type="text" required="required" placeholder="" class="gao">
            </div>
            <div class="tab_four">
                品牌所属集团<br />
                <input v-model="modeljd.suoshu_pinpai_jituan" type="text" required="required" placeholder="" class="gao">
            </div>
        </div>

        <div class="register">
            <div class="tab_four marfour">
                是否为连锁酒店<br />
                <select v-model="modeljd.is_liansuo" class="sel_width">
                    <option value="true">是</option>
                    <option value="false">否</option>
                </select>
            </div>
            <div class="tab_four marfour">
                客房总数<br />
                <input v-model="modeljd.kefang_zongshu" type="text" required="required" placeholder="" class="gao">
            </div>
            <div class="tab_four marfour">
                床位总数<br />
                <input v-model="modeljd.chuangwei_zongshu" type="text" required="required" placeholder="" class="gao">
            </div>
            <div class="tab_four">
                大床房间数<br />
                <input v-model="modeljd.dachuang_fangjian_shuliang" type="text" required="required" placeholder="" class="gao">
            </div>
        </div>

        <div class="register">
            <div class="tab_four marfour">
                大床床位数<br />
                <input v-model="modeljd.dachuang_chuangwei_shuliang" type="text" required="required" placeholder="" class="gao">
            </div>
            <div class="tab_four marfour">
                双标房间数<br />
                <input v-model="modeljd.shuangbiao_fangjian_shuliang" type="text" required="required" placeholder="" class="gao">
            </div>
            <div class="tab_four marfour">
                双标床位数<br />
                <input v-model="modeljd.shuangbiao_chuangwei_shuliang" type="text" required="required" placeholder="" class="gao">
            </div>
            <div class="tab_four">
                套房房数<br />
                <input v-model="modeljd.taofang_fangjian_shuliang" type="text" required="required" placeholder="" class="gao">
            </div>
        </div>

        <div class="register">
            <div class="tab_four marfour">
                套房床位数<br />
                <input v-model="modeljd.taofang_chuangwei_shuliang" type="text" required="required" placeholder="" class="gao">
            </div>
            <div class="tab_four marfour">
                残疾人无障碍房数<br />
                <input v-model="modeljd.wuzhangai_fangjian_shuliang" type="text" required="required" placeholder="" class="gao">
            </div>
            <div class="tab_four marfour">
                残疾人无障碍房床位数<br />
                <input v-model="modeljd.wuzhangai_chuangwei_shuliang" type="text" required="required" placeholder="" class="gao">
            </div>
            <div class="tab_four">
                会议室<br />
                <input v-model="modeljd.huiyishi_json" type="text" required="required" placeholder="数量、名称、面积" class="gao">
            </div>
        </div>
        <div class="register">
            <div class="tab_four marfour">
                餐厅<br />
                <input v-model="modeljd.canting_json" type="text" required="required" placeholder="数量、名称、面积" class="gao">
            </div>
            <div class="tab_four marfour">
                官方网站<br />
                <input v-model="modeljd.guanfang_wangzhan" type="text" required="required" placeholder="" class="gao">
            </div>
            <div class="tab_four marfour">
                电子邮箱<br />
                <input v-model="modeljd.dianzi_youxiang" type="text" required="required" placeholder="" class="gao">
            </div>
            <div class="tab_four">
                电话和传真<br />
                <input v-model="modeljd.dianhua" type="text" required="required" placeholder="" class="gao">
            </div>
        </div>
        <div class="register">
            <div class="tab_four marfour">
                单位负责人<br />
                <input v-model="modeljd.danwei_fuzeren" type="text" required="required" placeholder="" class="gao">
            </div>
            <div class="tab_four marfour">
                单位负责人联系电话<br />
                <input v-model="modeljd.danwei_fuzeren_dianhua" type="text" required="required" placeholder="" class="gao">
            </div>
            <div class="tab_four marfour">
                管理方<br />
                <input v-model="modeljd.guanlifang" type="text" required="required" placeholder="" class="gao">
            </div>
            <div class="tab_four">
                管理方联系人<br />
                <input v-model="modeljd.guanlifang_lianxiren" type="text" required="required" placeholder="" class="gao">
            </div>
        </div>
        <div class="register">
            <div class="tab_four marfour">
                管理方联系电话<br />
                <input v-model="modeljd.guanlifang_dianhua" type="text" required="required" placeholder="" class="gao">
            </div>
            <div class="tab_four marfour">
                业主方<br />
                <input v-model="modeljd.yezhufang" type="text" required="required" placeholder="" class="gao">
            </div>
            <div class="tab_four marfour">
                业主方联系人<br />
                <input v-model="modeljd.yezhufang_lianxiren" type="text" required="required" placeholder="" class="gao">
            </div>
            <div class="tab_four">
                业主方联系电话<br />
                <input v-model="modeljd.yezhufang_dianhua" type="text" required="required" placeholder="" class="gao">
            </div>
        </div>
        <div class="register">
            <div class="tab_four marfour">
                总投资额<br />
                <input v-model="modeljd.zongtouzi_e" type="text" required="required" placeholder="" class="gao">
            </div>
            <div class="tab_four marfour">
                用地面积<br />
                <input v-model="modeljd.yongdi_mianji" type="text" required="required" placeholder="" class="gao">
            </div>
            <div class="tab_four marfour">
                占地面积<br />
                <input v-model="modeljd.zhandi_mianji" type="text" required="required" placeholder="" class="gao">
            </div>
            <div class="tab_four">
                建筑面积<br />
                <input v-model="modeljd.jianzhu_mianji" type="text" required="required" placeholder="" class="gao">
            </div>
        </div>
        <div class="register01">
            <div class="duanluo">
                <span>特色介绍</span><br />
                <textarea v-model="modeljd.tese_jieshao" class="introduce"></textarea>
            </div>
        </div>

        <div class="register">
            <div class="upimage">
                营业执照<br />
                <div class="uplate">
                    <img id="img_yyzz" :src="modeljd.img_yingye_zhizhao" class="uppic">
                    <input id="yyzz" type="file" class="upinput" accept="*.jpeg, *.png, *.jpg, *.bmp " onchange="imgupload('yyzz')" />
                </div>
                <div class="tips">
                    用户展示使用，如没有logo可上传具有机构代表性图片，
                    格式：jpg/gif;图片件为图片格式，文件大小限制在5M
                </div>
            </div>

            <div class="upimage">
                特种行业许可证<br />
                <div class="uplate">
                    <img id="img_tzhyxkz" :src="modeljd.img_tezhong_hangye" class="uppic">
                    <input id="tzhyxkz" type="file" class="upinput" accept="*.jpeg, *.png, *.jpg, *.bmp " onchange="imgupload('tzhyxkz')" />
                </div>
                <div class="tips">
                    用户展示使用，如没有logo可上传具有机构代表性图片，
                    格式：jpg/gif;图片件为图片格式，文件大小限制在5M
                </div>
            </div>
        </div>
        <div class="information_tips"> 注册人信息</div>

        <div class="register">
            <div class="tab_name mar55">
                登录手机号<br />
                <input v-model="modelyh.zhanghao" type="text" required="required" placeholder="请输入手机号码" class="gao">
            </div>
            <div class="tab_name mar55">
                登录人姓名<br />
                <input v-model="modelyh.xingming" type="text" required="required" placeholder="请输入姓名" class="gao">
            </div>
            <div class="tab_name">
                手机验证码<br />
                <input v-model="modelyh.yanzhengma" type="text" required="required" placeholder="请输入手机验证码" class="yzm_width">
                <div id="divsendduanxin" class="yam_pic" onclick="sendduanxin();" style="cursor:pointer; color:blue">发送验证码</div>
            </div>
        </div>

        <div class="register">
            <div class="upimage">
                申请人身份证正面<br />
                <div class="uplate">
                    <img id="img_sqrsfzzm" :src="modeljd.img_shenqingren_sfz_zheng" class="uppic">
                    <input id="sqrsfzzm" type="file" class="upinput" accept="*.jpeg, *.png, *.jpg, *.bmp " onchange="imgupload('sqrsfzzm')" />
                </div>
                <div class="tips">
                    用户展示使用，如没有logo可上传具有机构代表性图片，
                    格式：jpg/gif;图片件为图片格式，文件大小限制在5M
                </div>
            </div>

            <div class="upimage">
                申请人身份证反面<br />
                <div class="uplate">
                    <img id="img_sqrsfzfm" :src="modeljd.img_shenqingren_sfz_fan" class="uppic">
                    <input id="sqrsfzfm" type="file" class="upinput" accept="*.jpeg, *.png, *.jpg, *.bmp " onchange="imgupload('sqrsfzfm')" />
                </div>
                <div class="tips">
                    用户展示使用，如没有logo可上传具有机构代表性图片，
                    格式：jpg/gif;图片件为图片格式，文件大小限制在5M
                </div>
            </div>
        </div>

        <div class="register">
            <div class="upimage">
                法人身份证正面<br />
                <div class="uplate">
                    <img id="img_frsfzzm" :src="modeljd.img_faren_shenfenzheng_zheng" class="uppic">
                    <input id="frsfzzm" type="file" class="upinput" accept="*.jpeg, *.png, *.jpg, *.bmp " onchange="imgupload('frsfzzm')" />
                </div>
                <div class="tips">
                    用户展示使用，如没有logo可上传具有机构代表性图片，
                    格式：jpg/gif;图片件为图片格式，文件大小限制在5M
                </div>
            </div>

            <div class="upimage">
                法人身份证反面<br />
                <div class="uplate">
                    <img id="img_frsfzfm" :src="modeljd.img_faren_shenfenzheng_fan" class="uppic">
                    <input id="frsfzfm" type="file" class="upinput" accept="*.jpeg, *.png, *.jpg, *.bmp " onchange="imgupload('frsfzfm')" />
                </div>
                <div class="tips">
                    用户展示使用，如没有logo可上传具有机构代表性图片，
                    格式：jpg/gif;图片件为图片格式，文件大小限制在5M
                </div>
            </div>
        </div>

        <div class="kong20"></div>
        <div class="btn_refer">
            <button class="refer" onclick="zhucep();">提交待审</button>
            <label id="lb_errmg" class="ft-red" style="display:none;">注册失败</label>
        </div>
        <div class="kong20"></div>
    </div>

    <div class="modal fade" id="myModalMap" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog" style="width:80%;">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                    <h4 class="modal-title" id="myModalLabel">选择经纬度</h4>
                </div>
                <div class="modal-body">
                    <div class="row" style="margin-bottom:5px;">
                        <div class="col-xs-3">
                            <input id='lng' type="text" placeholder="经度" class="gao">
                        </div>
                        <div class="col-xs-3">
                            <input id='lat' type="text" placeholder="纬度" class="gao">
                        </div>
                        <div class="col-xs-6">
                            <input id='sever_add' type="text" placeholder="地址" class="gao">
                        </div>
                    </div>

                    <div id='allmap' style='height:500px;'></div>

                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button type="button" class="btn btn-primary" data-dismiss="modal">确定</button>
                </div>
            </div>
        </div>
    </div>

    <div class="modal fade" id="myModalArea" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                    <h4 class="modal-title" id="myModalLabel">行政区划</h4>
                </div>
                <div class="modal-body" style="height:80px;">
                    <div class="form-group">
                        <div class="col-sm-4">
                            <select id="sl_shi" class="form-control">
                                <option value="0"></option>
                            </select>
                        </div>
                        <div class="col-sm-4">
                            <select id="sl_xian" class="form-control">
                            </select>
                        </div>
                        <div class="col-sm-4">
                            <select id="sl_xiang" class="form-control">
                            </select>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button type="button" class="btn btn-primary" onclick="AreaConfirm();">确定</button>
                </div>
            </div>
        </div>
    </div>

</body>
</html>

<script>
    var vm = new Vue({
        el: '#app',
        data: {
            modeljd: @Html.Raw(ViewBag.modeljdstr),
            modelyh: { "zhanghao": "", "xingming": "", "yanzhengma": "" },
        },
        methods: {

        }
    });
    $(function () {
        get_hotel_local();
        get_yonghu_local();
        save_local();
        laydate.render({
            elem: '#inp_kaiye_riqi'
            , format: 'yyyy-MM-dd'
        });
        laydate.render({
            elem: '#inp_pingxing_riqi'
            , format: 'yyyy-MM-dd'
        });
    })

    function imgupload(id) {
        if ($("#" + id)[0].files.length <= 0) {
            return false;
        }
        var formData = new FormData();
        formData.append('file', $("#" + id)[0].files[0]);
        $.ajax({
            url: "/login/ImgUpload",//后台接收数据地址
            //headers:{'Content-Type':'multipart/form-data'},//加上这个报错
            data: formData,
            type: "POST",
            dataType: "json",
            cache: false,			//上传文件无需缓存
            processData: false,		//用于对data参数进行序列化处理 这里必须false
            contentType: false,
            success: function (res) {
                $("#img_" + id).attr("src", res.data);
                if (id == "yyzz") {
                    vm.modeljd.img_yingye_zhizhao = res.data;
                }
                else if (id == "tzhyxkz") {
                    vm.modeljd.img_tezhong_hangye = res.data;
                }
                else if (id == "sqrsfzzm") {
                    vm.modeljd.img_shenqingren_sfz_zheng = res.data;
                }
                else if (id == "sqrsfzfm") {
                    vm.modeljd.img_shenqingren_sfz_fan = res.data;
                }
                else if (id == "frsfzzm") {
                    vm.modeljd.img_faren_shenfenzheng_zheng = res.data;
                }
                else if (id == "frsfzfm") {
                    vm.modeljd.img_faren_shenfenzheng_fan = res.data;
                }
                if (res.code > 0) {
                    localStorage.setItem("modeljd", JSON.stringify(vm.modeljd));
                } else {
                    alert("图片上传失败！");
                }
            },
            failure: function (res) {

            }
        });
    }

    function get_hotel_local() {
        var modeljdstr = localStorage.getItem("modeljd");
        if (modeljdstr) {
            vm.modeljd = JSON.parse(modeljdstr);
            $("#inp_kaiye_riqi").val(vm.modeljd.kaiye_riqi);
            $("#inp_pingxing_riqi").val(vm.modeljd.pingxing_riqi);
        }
        else {
            $.post("/login/getmodeljd", {}, function (res) {
                vm.modeljd = res;
            });
        }

    }

    function get_yonghu_local() {
        var modelyhstr = localStorage.getItem("modelyh");
        if (modelyhstr) {
            vm.modelyh = JSON.parse(modelyhstr);
        }

    }

    function save_local() {
        setInterval(function () {
            vm.modeljd.kaiye_riqi = $("#inp_kaiye_riqi").val();
            vm.modeljd.pingxing_riqi = $("#inp_pingxing_riqi").val();
            localStorage.setItem("modeljd", JSON.stringify(vm.modeljd));
            localStorage.setItem("modelyh", JSON.stringify(vm.modelyh));
        }, 5000);
    }


    //地图
    var map = new BMap.Map("allmap");
    var geoc = new BMap.Geocoder(); //地址解析对象
    var markersArray = [];
    var geolocation = new BMap.Geolocation();
    var point = new BMap.Point(109.877003, 20.121098);
    map.centerAndZoom(point, 12); // 中心点
    map.addControl(new BMap.NavigationControl());
    map.addControl(new BMap.ScaleControl());
    map.addControl(new BMap.OverviewMapControl());
    map.enableScrollWheelZoom();
    map.addControl(new BMap.MapTypeControl());
    geolocation.getCurrentPosition(function (r) {
        if (this.getStatus() == BMAP_STATUS_SUCCESS) {
            var mk = new BMap.Marker(r.point);
            map.addOverlay(mk);
            map.panTo(r.point);
            map.enableScrollWheelZoom(true);
        }

        else {
            alert('failed' + this.getStatus());
        }

    }, { enableHighAccuracy: true })

    map.addEventListener("click", showInfo);
    //清除标识
    function clearOverlays() {
        if (markersArray) {
            for (i in markersArray) {
                map.removeOverlay(markersArray[i])
            }
        }
    }

    //地图上标注
    function addMarker(point) {
        var marker = new BMap.Marker(point);
        markersArray.push(marker);
        clearOverlays();
        map.addOverlay(marker);
    }

    //点击地图时间处理
    function showInfo(e) {
        document.getElementById('lng').value = e.point.lng;
        document.getElementById('lat').value = e.point.lat;
        geoc.getLocation(e.point, function (rs) {
            var addComp = rs.addressComponents;
            var address = addComp.province + addComp.city + addComp.district + addComp.street + addComp.streetNumber;
            document.getElementById('sever_add').value = address;
        });
        addMarker(e.point);
        vm.modeljd.jingdu = e.point.lng;
        vm.modeljd.weidu = e.point.lat;
    }

    //短信
    var intervalindex = -1;
    function sendduanxin() {
        $.post("/login/sendduanxin", { name: vm.modelyh.zhanghao, imgyzm: "0000" }, function (res) {
            showerr(true, res.msg);
            if (res.code > 0) {
                var secondleft = 59;
                intervalindex = setInterval(function () {
                    if (secondleft > 0) {
                        secondleft--;
                        $("#divsendduanxin").html("重试(" + secondleft + ")");
                    }
                    else {
                        clearInterval(intervalindex);
                        $("#divsendduanxin").html("发送验证码");
                    }
                }, 1000)

            }
        })
    }
    //错误
    function showerr(show, msg) {
        if (show) {
            $("#lb_errmg").html(msg);
            $("#lb_errmg").show();
        }
        else {
            $("#lb_errmg").hide();
        }
    }

    //行政区划
    $(function () {
        //默认绑定省
        ShiBind();
        //绑定事件
        $("#sl_shi").change(function () {
            XianBind();
        });
        $("#sl_xian").change(function () {
            XiangBind();
        });
    });
    function ShiBind() {
        $.ajax({
            type: 'POST',
            url: '/login/getarea?action=bindShi&id=-1',
            dataType: 'json',
            success: function (datas) {
                //返回list数据并循环获取
                var select = $("#sl_shi");
                for (var i = 0; i < datas.length; i++) {
                    select.append("<option value='" + datas[i].areaId + "'>"
                        + datas[i].areaName + "</option>");
                }
                select.val(2205);
                XianBind();
            }
        });
    }
    function XianBind() {
        var shi = $("#sl_shi").val();
        //判断下拉框选中的值是否为空
        if (shi == "") {
            return;
        }
        $("#sl_xian").html("");
        $("#sl_xiang").html("");
        $.ajax({
            type: "POST",
            url: "/login/getarea",
            data: { "action": "bindXian", "id": shi },
            dataType: "JSON",
            async: false,
            success: function (datas) {
                //返回list数据并循环获取
                var select = $("#sl_xian");
                select.append("<option value='0'>   </option>");
                for (var i = 0; i < datas.length; i++) {
                    select.append("<option value='" + datas[i].areaId + "'>"
                        + datas[i].areaName + "</option>");
                }
            }
        });
    }
    function XiangBind() {
        var xian = $("#sl_xian").val();
        if (xian == "") {
            return;
        }
        $("#sl_xiang").html("");
        $.ajax({
            type: "POST",
            url: "/login/getarea",
            data: { "action": "bindXiang", "id": xian,  },
            dataType: "JSON",
            async: false,
            success: function (datas) {
                //返回list数据并循环获取
                var select = $("#sl_xiang");
                select.append("<option value='0'>   </option>");
                for (var i = 0; i < datas.length; i++) {
                    select.append("<option value='" + datas[i].areaId + "'>"
                        + datas[i].areaName + "</option>");
                }
            }
        });
    }
    function AreaConfirm() {
        var aid = 0;
        var xiang = $("#sl_xiang").val();
        if (xiang == 0) {
            var xian = $("#sl_xian").val();
            if (xian == 0) {
                alert("请完整选择行政区划！");
                return false;
            }
            aid = xian;
        }
        else {
            aid = xiang;
        }
        vm.modeljd.aid = aid;
        var areatxt = $("#sl_shi").find("option:selected").text() + " " + $("#sl_xian").find("option:selected").text() + " " + $("#sl_xiang").find("option:selected").text();
        vm.modeljd.xingzheng_quhua = areatxt;
        $('#myModalArea').modal('toggle');
        //立即保存
        localStorage.setItem("modeljd", JSON.stringify(vm.modeljd));
    }

    //注册
    function zhucep() {
        //立即保存
        localStorage.setItem("modeljd", JSON.stringify(vm.modeljd));
        localStorage.setItem("modelyh", JSON.stringify(vm.modelyh));
        $.post("/login/zhucep", { modelyh: JSON.stringify(vm.modelyh), modeljd: JSON.stringify(vm.modeljd) }, function (res) {
            if (res.code > 0) {
                localStorage.setItem("modeljd", "");
                localStorage.setItem("modelyh", "");
                alert(res.msg);
                to_url(res.data);
                return false;
            }
            else {
                showerr("lb_errmg", res.msg);
                alert(res.msg);
                return false;
            }
        })
    }
</script>

